<?php

namespace Buickwang\Calculator;


use Buickwang\Calculator\Calculators\StraightLineDepreciation;
use Symfony\Component\Finder\Finder;
use Symfony\Component\VarDumper\VarDumper;

class Generator
{
    /**
     * @description 获取计算器列表
     * @user SMJT-02
     * @date 2024/8/14
     * @time 10:30
     * @return array
     */
    public static function lists()
    {
        $finder = Finder::create()->files()->in(__DIR__ . '/Calculators');
        $namespace = 'Buickwang\\Calculator\\Calculators\\';

        $lists = [];
        foreach ($finder as $key => $item) {
            $class = basename($item->getFilename(), '.php');
            $classname = $namespace . $class;
            $calculator = new $classname();
            $lists[$class] = $calculator->getName();
        }

        return $lists;
    }

    /**
     * @description 获取残值率
     * @user SMJT-02
     * @date 2024/8/14
     * @time 10:38
     * @return float[]
     */
    public static function rates()
    {
        return [
            '0.03' => '3%',
            '0.05' => '5%'
        ];
    }
}